package json_object_mapper;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.webrtc.SessionDescription;

import java.io.IOException;

public class SDPTypeDeserializer extends JsonDeserializer<SessionDescription.Type> {
    private static final Logger logger = LoggerFactory.getLogger(SDPTypeDeserializer.class);

    @Override
    public SessionDescription.Type deserialize(JsonParser p, DeserializationContext ctx) throws IOException {
        return SessionDescription.Type.valueOf(p.getValueAsString().toUpperCase());
    }
}
